<template>
  <div class="app-container">
    <!-- 搜索区 -->

    <!--功能区-->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd()"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate()"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete()"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExcel()"
        >导出</el-button>
      </el-col>
    </el-row>


    <el-table :data="tableData.rows" border style="width: 100%" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column prop="id" label="仓库编码" width="140" />
      <el-table-column prop="name" label="仓库名称" width="300" />

      <el-table-column label="操作" align="center"  class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" >修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <!-- 分页条 -->
    <el-pagination v-if="tableData.total>0" :current-page="queryParam.page" :page-sizes="[1, 5, 10, 20,30,50,100]"
                   :page-size="queryParam.size" layout="total, sizes, prev, pager, next, jumper" :total="tableData.total"
                   @size-change="handleSizeChange" @current-change="handleCurrentChange" />



    <!-- 新增和修改对话框-->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false" :before-close="cancelForm">
      <el-form ref="form" :model="form"   label-width="100px">
        
        <el-form-item   label="仓库名称" prop="name"  :rules="[  { required: true, message: '该值不能为空', trigger: 'blur' }]">
          <el-input v-model="form.name" placeholder="请输入名称(唯一)"  />
        </el-form-item>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancelForm">取 消</el-button>
      </div>
    </el-dialog>


  </div>
</template>

<script>
import PageMixin from '@/mixins/PageMixin.js'
import AddOrEditMixin from '@/mixins/AddOrEditMixin.js'
import {dataApi, addApi, editApi, findByIdApi} from '@/api/car/store'
export default {
  mixins: [PageMixin, AddOrEditMixin],
  data() {

    return {
      // 查询函数
      fetchDataApi: dataApi,
      // 新增函数
      addApi: addApi,
      // 新增函数
      editApi: editApi,
      // 新增函数
      findByIdApi: findByIdApi,
      primaryKey: 'id',
      //头像放到表单哪个字段里面
      uploadField: undefined
    }
  },
  methods: {
    // 重置表单
    initFormValue(){
      this.form= {
      }
    },
    handleExcel(){
      // this.download('/api/employee/download',this.queryParam,'employee_data.xlsx')
    }

  },
  created(){
    this.initFormValue()
  }

}
</script>

<style>
</style>
